#include <iostream>
#include <string>
#include "Sales_data.h"

int main()
{
    data data1, data2;
    double price = 0;

    std::cin >> data1.isbn >> data1.num >> data1.price;
    std::cin >> data2.isbn >> data2.num >> data2.price;
    data1.income = data1.num * data1.price;
    data2.income = data2.num * data2.price;

    if (data1.isbn == data2.isbn)
    {
        int total_num = data1.num + data2.num;
        double total_income = data1.income + data2.income;
        std::cout << "ISBN:" << data1.isbn << " Number:" << total_num
            << " Income:" << total_income << " ";
        if (total_num != 0)
            std::cout << "Average:" << total_income / total_num << std::endl;
        else
            std::cout  << "No sales!" << std::endl;
        while(1);
        return 0;
    }
    else
    {
        std::cerr << "Data must refer to the same ISBN!" << std::endl;
        while(1);
        return -1;
    }
}